#ifndef MAINWINDOW_H
#define MAINWINDOW_H


#include <QMainWindow>
#include "pcap.h"
#include "winsock2.h"
#include "datapackage.h"
#include <QVector>
#include "readonlydelegate.h"


namespace Ui {
class MainWindow;
}

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    //
    explicit MainWindow(QWidget *parent = nullptr);
    ~MainWindow();
    // 显示网卡
    void showNetworkCard();
    // 捕获数据包
    int capture();
signals:
    send_port();
    void setShowType(int);//设置显示数据类型

private slots:
    void on_comboBox_currentIndexChanged(int index);
    void on_tableWidget_cellClicked(int row, int column);
    void on_lineEdit_returnPressed();
    void on_lineEdit_textChanged(const QString &arg1);
    void on_Tablewidget_Currentcellchanged(int currentRow, int currentColumn, int previousRow, int previousColumn);


    void on_tableWidget_2_clicked(const QModelIndex &index);

public slots:
    void HandleMessage(Datapackage data);

private:

    Ui::MainWindow *ui;
    pcap_if_t *all_device;
    pcap_if_t *device;
    pcap_t *pointer;
    QVector<Datapackage>pData;
   ReadOnlyDelegate *readOnlyDelegate;
    int countNumber;
    char errbuf[PCAP_ERRBUF_SIZE];
    int numberRow;
    bool isStart;
    int showList_Type;//标志位，改变时显示类型数据2进制10进制16进制

};

#endif // MAINWINDOW_H
